package com.topn2;

import org.apache.hadoop.io.WritableComparator;

public class TGroupingComparator extends WritableComparator {
    public TGroupingComparator() {
        super(Tkey.class, true);
    }

    @Override
    public int compare(Object a, Object b) {
        Tkey k1 = (Tkey) a;
        Tkey k2 = (Tkey) b;
        if (k1.getYear() == k2.getYear() && k1.getMonth() == k2.getMonth()) {
            return 0;
        }
        return 1;
    }
}
